//
//  YDStockMarketDiskDataDetailView.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2018/1/19.
//  Copyright © 2018年 LK-IOS. All rights reserved.
//

#import "YDStockMarketDiskDataDetailView.h"
#import "YDStockMarketDiskDataStateView.h"
#import "YDStockMarketDiskDataView.h"

@interface YDStockMarketDiskDataDetailView()
//状态View
@property (nonatomic , weak) YDStockMarketDiskDataStateView *dataStateView;
//数据View
@property (nonatomic , weak) YDStockMarketDiskDataView *dataView;

@end

@implementation YDStockMarketDiskDataDetailView

-(void)setStockDict:(NSDictionary *)stockDict
{
    _stockDict = stockDict;
    if (![stockDict count])return;
    self.dataStateView.stockDict = stockDict;
    self.dataView.stockDict = stockDict;
    
}
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        
        [self dataStateView];
        
        [self dataView];
        
        
    }
    return self;
}


+(instancetype)stockMarketDiskDataDetailViewWithStockDict:(NSDictionary *)stockDict
{
    YDStockMarketDiskDataDetailView *detailView = [[YDStockMarketDiskDataDetailView alloc] init];
    detailView.stockDict = stockDict;
    return detailView;
}

-(YDStockMarketDiskDataStateView *)dataStateView
{
    if (_dataStateView == nil) {
        YDStockMarketDiskDataStateView *dataStateView = [YDStockMarketDiskDataStateView stockMarketDiskDataStateViewWithStockDict:self.stockDict];
        dataStateView.frame = CGRectMake(0, 0, LKScreenW, isPhoneX ? rateX812(55) : rate750(55));
        [self addSubview:dataStateView];
        _dataStateView = dataStateView;
    }
    return _dataStateView;
}

-(YDStockMarketDiskDataView *)dataView
{
    if (_dataView == nil) {
        YDStockMarketDiskDataView *dataView = [YDStockMarketDiskDataView stockMarketDiskDataViewWithStockDict:self.stockDict];
        dataView.frame = CGRectMake(0, CGRectGetMaxY(self.dataStateView.frame) + 1, LKScreenW, isPhoneX ? rateX812(56) : rate750(56));
        [self addSubview:dataView];
        _dataView = dataView;
    }
    return _dataView;
}




@end
